var gulp = require("gulp");
var sftp = require("gulp-sftp-up4");
const path = require("path");
const fg = require("fast-glob");

const argsMap = {};
(function (...args) {
  let args1 = args[0].slice(2);
  while (args1.length >= 0) {
    let key = args1.shift();
    if (!key) break;
    key = key.replace(/\-/gi, "");
    if (key.indexOf("=") > -1) {
      key = key.split("=");
      argsMap[key[0]] = key[1];
    }
  }
})(process.argv);

// console.log(argsMap);

const srcDist = ["./html/**"];

gulp.task("ftp", function (done) {
  gulp.src(srcDist).pipe(
    sftp({
      host: "36.133.76.226",
      auth: "Server1",
      port: 23432,
      remotePath:
        argsMap.type == "prod"
          ? "/data/vue/sturgeon/erp/land/html/"
          : "/data/vue/sturgeon/erptest/land/html/",
    })
  );

  done();
});



